<!DOCTYPE html>


<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>伪类选择器</title>
    <style>
        .div :nth-child(3) {
            color: red;
        }
        
        .div p:nth-of-type(2) {
            background-color: lightblue;
        }
        
        .div :nth-last-child(2) {
            border: 2px solid green;
        }
        
        .div div:nth-last-of-type(1) {
            font-weight: bold;
        }
    </style>
</head>

<body>
    <div class="div">
        <p>段落1段落1段落1段落1</p>
        <div>div1div1div1div1div1</div>
        <p>段落2段落2段落2段落2段落2</p>
        <div>div2div2div2div2div2div2</div>
        <p>段落3段落3段落3段落3段落3段落3</p>
        <div>div3div3div3div3div3div3</div>
    </div>
</body>

</html>